SUFFIX:=.cpp#文件后缀

#服务器部分的源文件和编译文件
server_src:=$(wildcard src/net/*$(SUFFIX)) $(wildcard src/local/*$(SUFFIX)) $(wildcard src/cache/*$(SUFFIX)) libs/Mylog.cpp src/server.cpp
server_obj:=$(server_src:$(SUFFIX)=.o)

#客户端部分的源文件和编译文件
client_src:=$(wildcard client/*$(SUFFIX))
client_obj:=$(client_src:$(SUFFIX)=.o)

ELF:=bin/server bin/client 
CFLAGS:=-g -Wall
CC:=g++# 编译器 
all:$(server_obj) $(client_obj) $(ELF)

bin/server:$(server_obj)
	$(CC) $(CFLAGS) -o $@ $^ -llog4cpp -ljsoncpp -pthread 

bin/client:$(client_obj)
	$(CC) $(CFLAGS) -o $@ $^ -ljsoncpp -pthread 
%.o:%$(SUFFIX)
	$(CC) -c $(CFLAGS) $^ -o $@

.PHONY:clean rebuild

clean:
	@rm -rf $(ELF) $(server_obj) $(client_obj) || [ 1 ]

rebuild:clean all